Skip to content

fix: copy dicom inputs before running dcm2niix#60

Open
AlwinXue wants to merge 1 commit intoOSIPI:mainfrom
AlwinXue:alwin/fix-issue-40
Open

fix: copy dicom inputs before running dcm2niix#60
AlwinXue wants to merge 1 commit intoOSIPI:mainfrom
AlwinXue:alwin/fix-issue-40

Conversation

@AlwinXue
Copy link
Copy Markdown

@AlwinXue AlwinXue commented Mar 31, 2026

Hi mentors! 👋

This PR addresses the DICOM conversion flow bug reported in Issue #40.

The Problem:
DICOM2NiFTIConverter.convert() created a temporary directory and then immediately checked whether it was empty, but it never copied the incoming DICOM files into that directory. As a result, the converter returned No DICOM files found. before dcm2niix could ever run.

The Solution:
Copy Inputs Into Temp Directory: Each uploaded DICOM file is now copied into the converter's temporary working directory before metadata extraction and subprocess execution.
Preserve Existing Metadata Logic: The existing SeriesNumber and lRepetitions extraction logic is kept intact.
Regression Coverage: Added a focused converter test that verifies the temporary input directory is populated, subprocess.run() is reached, and the generated JSON gets the expected lRepetitions value.

Validation:
Ran python -m pytest package/src/pyaslreport/tests/test_dicom_to_nifti_converter.py -q and the new converter regression test passed.

Fixes #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DICOM converter never copies files to temp_dir — dcm2niix subprocess is never called

1 participant